<template>
  <j-modal
    :title="'报表审批'"
    :width="800"
    :visible="visible"
    :maskClosable="false"
    :ok-button-props="{ props: { disabled: disableSubmit } }"
    :fullscreen="true"
    @close="close"
    cancelText="关闭"
  >
    <template slot="footer">
      <a-button key="back" style="padding-left: 20px; padding-right: 20px" @click="close"> 关闭 </a-button>
      <a-popconfirm title="确定不通过吗?" style="width: 150px" @confirm="() => setApproveReason('2')">
        <a-button key="save" style="padding-left: 8px; padding-right: 8px"> 不通过 </a-button>
      </a-popconfirm>
      <a-popconfirm title="确定通过吗?" style="width: 150px" @confirm="() => setApproveReason('1')">
        <a-button key="submit" type="primary"> 通过 </a-button>
      </a-popconfirm>
    </template>
    <a-spin :spinning="Loading">
      <div :class="{ isCheck: isCheck }">
        <!-- <div class="table-header">
          <span class="table-title">填报单位：</span>{{ model.departName }} <span class="table-title">审计负责人：</span
          >{{ model.auditPersonName }} <span class="table-title">填表人：</span>{{ model.createByText }}
          <span class="table-title">填表时间：</span>{{ model.createTime }} <span class="table-title">统计时间：</span
          >{{ model.year }}年（{{ model.quarter }}季度）
          <span class="table-title">说明性文件:</span>
        </div> -->
        <a-table
          class="edit-list"
          ref="table"
          size="middle"
          bordered
          width="100vw"
          rowKey="xu"
          :pagination="false"
          :columns="columns"
          :dataSource="dataSource"
          :scroll="{ x: 250, y: 520 }"
        >
          <!-- 表头 -->
          <div slot="title">
            <div class="title">{{ title }}</div>
            <div class="sub-title">
              <div>填报单位：{{ model.departName }}</div>
              <div>{{ model.year }}年（{{ model.quarter }}季）度</div>
              <div>审计负责人：{{ model.auditPersonName }}</div>
              <div>填表人：{{ model.createByText }}</div>
              <div>填表时间：{{ model.createTime }}</div>
              <div>金额单位（万元）</div>
            </div>
          </div>

          <template slot="customTitle">
            <div class="header-title">
              <div style="position: absolute; top: 62px; left: -51px">项目</div>
              <div style="position: absolute; top: 11px; left: 20px; width: 30px">内容</div>
              <div
                style="
                  content: '';
                  position: absolute;
                  width: 1px;
                  height: 188px;
                  top: -40px;
                  left: 0px;
                  background-color: rgb(200 207 211);
                  display: block;
                  transform: rotate(305deg);
                  box-sizing: border-box;
                "
              />
            </div>
          </template>

          <template slot="name" slot-scope="name">
            <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ name }}</div>
          </template>

          <template v-for="col in customRenderList" v-slot:[col]="text, record, index">
            <div :key="col" v-if="record.name == '合计'">
              <span class="spancell">{{ record[col] }}</span>
            </div>
            <div :key="col" v-else>
              <span>{{ record[col] }}</span>
            </div>
          </template>
          <template v-for="item in spancell" v-slot:[item]="text">
            <span class="spancell" :key="item">{{ text }}</span>
          </template>
        </a-table>
        <FileTag :apiId="model.fileId"></FileTag>
      </div>
    </a-spin>

    <SetReason ref="setReason" @approveData="approveData1"></SetReason>
  </j-modal>
</template>
<script>
import columns from './columns2'
import SetReason from '../SetReason'
import FileTag from '../../../components/FileTag'
import { BbspModelMixin } from './BbspModelMixin'
export default {
  name: 'CheckAndEditModel',
  mixins: [BbspModelMixin],
  components: {
    SetReason,
    FileTag,
  },
  data() {
    return {
      model: {},
      columns: columns(this),
      reportType: '2',
      approveType: '1',
      url: {
        list: '/sjxxzhgl/sjProjectReport/queryProjectReportInfoById',
        approve: '/common/sjProcCommon/reportApply',
      },
      spancell: ['a1', 'a17'],
      customRenderList: [
        'a2',
        'a3',
        'a4',
        'a5',
        'a6',
        'a7',
        'a8',
        'a9',
        'a10',
        'a11',
        'a12',
        'a13',
        'a14',
        'a15',
        'a16',
        'a18',
        'a19',
        'a20',
        'a21',
      ],
    }
  },
  created() {},
  methods: {
    // 审批
    approve(record) {
      this.Loading = true
      this.model.id = record.id
      this.visible = true
      this.getTableData1()
    },
  },
}
</script>

<style lang="less" scoped>
// @import '../../../css/checkAndEdit.less';
@import '../../css/baobiaotable.less';
.table-header {
  margin-bottom: 10px;

  .table-title {
    font-weight: bold;
    margin-left: 15px;
  }
}
</style>
